#include <myheader.h>

typedef struct student{
    int id;
    char name[20];
    int score;
}student;

/* Usage:  */
int main(int argc, char *argv[]){                                  
    struct student s[3]={
        {1,"zs",90},
            {2,"ls",80},
            {3,"ww",70}
    };
    FILE*file=fopen("1.txt","wb");
    ERROR_CHECK(file,NULL,"open");


    fwrite(s,sizeof(struct student),3,file);
    fclose(file); 
    
    file=fopen("1.txt","r");
    fread(s,sizeof(struct student),3,file);
    fclose(file);

    printf("学生\t学号\t成绩\t\n");
    for(int i=0;i<3;i++){
        printf("学生%s\t学号:%d\t成绩%d\n",s[i].name,s[i].id,s[i].score);
    }

    return 0;
}

